/
bar-multicolor-multiseries-center-figure[4star].tex
59 lines (50 loc) · 1.9 KB
/
bar-multicolor-multiseries-center-figure[4star].tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% Vertical bar chart with different colors for each bar [duplicate]
% https://tex.stackexchange.com/questions/381213/vertical-bar-chart-with-different-colors-for-each-bar?noredirect=1&lq=1
\documentclass{article}
\usepackage{xcolor}
\usepackage{pgfplots, pgfplotstable}
\usepackage{tikz}
% tight page
\usepackage[active,tightpage]{preview} % set tight page
\PreviewEnvironment{tikzpicture} % preview tikz
\setlength\PreviewBorder{10pt}% % gap around plot
\definecolor{hous}{HTML}{b88b4d}
\definecolor{green}{HTML}{79c561}
\definecolor{farming}{HTML}{ded94c}
\definecolor{trans}{HTML}{b4b4a9}
\definecolor{services}{HTML}{ff362e}
\definecolor{other}{HTML}{dbd4d3}
\definecolor{industry}{HTML}{db79c0}
\definecolor{water}{HTML}{7982db}
\definecolor{techinfra}{HTML}{303355}
\begin{document}
\begin{center}
\begin{figure}
\label{landuse}
\begin{tikzpicture}
\begin{axis}[
ybar=-1cm,
axis x line*=bottom,
axis y line*=left,
height=8cm, width=\textwidth,
bar width=1cm,
ylabel={Share of land use in [\%]},
symbolic x coords={Housing,Urban green,Farmlands,Transport infrastructure,Services,Other,Industrial,Water bodies,Technical infrastructure},
x tick label style={rotate=45, anchor=east, align=left},
nodes near coords,
nodes near coords align={vertical}
]
\addplot[hous,fill] coordinates {(Housing,28)};
\addplot[green,fill] coordinates {(Urban green,28)};
\addplot[farming,fill] coordinates {(Farmlands,12)};
\addplot[trans,fill] coordinates {(Transport infrastructure,10)};
\addplot[services,fill] coordinates {(Services,7)};
\addplot[other,fill] coordinates {(Other,6)};
\addplot[industry,fill] coordinates {(Industrial,5)};
\addplot[water,fill] coordinates {(Water bodies,3)};
\addplot[techinfra,fill] coordinates {(Technical infrastructure,1)};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{center}
\end{document}